package com.sacc.controller;


import com.power.common.model.CommonResult;
import com.sacc.pojo.OrderList;
import com.sacc.pojo.OrderStateAll;
import com.sacc.service.OrderStateAllService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 滚~韬
 * @date 2022/4/7 18:40
 */
@RestController
@RequestMapping("/order/state")
public class OrderWaitController {

    @Autowired
    private OrderStateAllService orderStateAllService;

    /**
     * 获得订单列表
     * @param openId
     * @return
     */
    @GetMapping("/get")
    public List<OrderList> GetWait(String openId, Integer state){
        return orderStateAllService.getOrderByState(openId,state);
    }

    /**
     * 更新订单进入下一层状态,4表示完成状态
     * @param orderNumber
     * @return
     */
    @GetMapping("/update")
    public CommonResult UpdateWait(String orderNumber){
        return orderStateAllService.GoNextState(orderNumber);
    }

}
